package com.qf.mrmd.service.impl;

import com.qf.mrmd.dao.OrderDao;
import com.qf.mrmd.dao.ShopDao;
import com.qf.mrmd.dao.SysUserDao;
import com.qf.mrmd.result.ResponseCode;
import com.qf.mrmd.result.ResponseData;
import com.qf.mrmd.service.HomeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;

@Service
public class HomeServiceImpl implements HomeService {

    @Resource
    private OrderDao orderDao;

    @Resource
    private SysUserDao sysUserDao;

    @Resource
    private ShopDao shopDao;

    @Override
    public ResponseData getCount() {
        HashMap<String,Integer> map = new HashMap<>();
        map.put("orders",orderDao.countOrder());
        map.put("users",sysUserDao.countUser());
        map.put("shops",shopDao.countShop());
        return new ResponseData(ResponseCode.SUCCESS,map);
    }
}
